<?php
/**
 * 定义对于用户信息更改请求的操作
 *
 * @todo
 * @author Judas <judasnow@gmail.com>
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
 */
class update_admin_info_process{

	private $db ;
	private $db_obj_admin;
	

	function __construct( $db , $admin ){
		
		$this->db = $db ;
		$this->db_obj_admin = new db_obj_admin( $this->db );

		if ( !$this->db_obj_admin->admin_exists( $admin )){
			throw new Exception( '此用户名不存在' );
		}

		$this->db_obj_admin->load( 'admin' , $admin );

		
	}
	
	function update_password( $new_password ){
		
		$this->db_obj_admin->set( 'passwd' , md5($new_password) );
		$this->db_obj_admin->save();

		return true ;
	}


}

